import {
  getSecurity,
  getKnowledgeLevel,
  getCoursewareType,
  getQuestionType,
} from '@/api/position/common';
import { userSecurity } from '@/api/system/user';

export const useCommonApi = WEBSITE => {
  getSecurity().then(res => {
    WEBSITE.securityLists = res.data.data.map(item => {
      return {
        label: item.name,
        value: item.key,
      };
    });
  });
  getKnowledgeLevel().then(res => {
    WEBSITE.knowledgeLevelLists = res.data.data.map(item => {
      return {
        label: item.name,
        value: item.key,
      };
    });
  });
  getCoursewareType().then(res => {
    WEBSITE.coursewareType = res.data.data.map(item => {
      return {
        label: item.name,
        value: item.key,
      };
    });
  });
  getQuestionType().then(res => {
    WEBSITE.questionType = res.data.data.map(item => {
      return {
        label: item.name,
        value: item.key,
      };
    });
  });
  userSecurity().then(res => {
    WEBSITE.userSecurity = res.data.data.map(item => {
      return {
        label: item.name,
        value: item.key,
      };
    });
  });
};
